Mailslot Control

Properties

Description

The Mailslot control provides simple interprocess communication between programs running on the same or different computers running Windows for Workgroups.

Comments

The Mailslot control enables you to create and use Windows for Workgroups mailslots. A mailslot is an application-defined buffer that receives and holds messages. Applications create mailslots so that they can receive text or data from other applications running on one or more computers in a network.


Mailslot Properties

Action	Priority
MailslotName	Timeout
MessageSize	NextSize
MailslotSize	NextPriority
Message


Action (Mailslot)

Applies To

Mailslot

Description

Specifies the type of mailslot function to execute.  Not available at design time.

Usage

[form.]Mailslot.Action[ = setting ]

Remarks

The Action property settings are:

Setting	Mailslot action
0	No action
1	Create
2	Delete
3	Write
4	Read
5	Peek
Data Type

Integer (Enumerated)


Create

Creates a new mailslot on the local computer.

Before executing the Create action you must first set the MailslotName, Mailslot, and MessageSize properties.


Delete

Deletes a mailslot, an error is returned if the Mailslot has not been created.


Write

Writes a message to the mailslot. Before invoking the Write action you must first set the MailslotName and Message properties.


Read

Reads a message from the mailslot. Before invoking the Read action you must first create the mailslot.


Peek

Checks the mailslot to see if any messages are available. Before invoking the Peek action you must first create the mailslot.


MailslotName (Mailslot)

Applies To

Mailslot

Description

Specifies the name of the mailslot.

Usage

[form.]Mailslot.MailslotName[ = setting ]

Remarks

String specifying the name of the mailslot. The mailslot name can have one of the following formats:

Format	Meaning
\mailslot\mailslotname	This format writes to a mailslot on the local computer.
\\computername\mailslot\mailslotname	This format writes to a mailslot on the specified computer.
\\workgroupname\mailslot\mailslotname	This format writes to a mailslot on all computers in the specified workgroup. If workgroupname is an asterisk (*), all computers in the workgroup of the current computer are written to.
Data Type

String


MessageSize (Mailslot)

Applies To

Mailslot

Description

Specifies the maximum number bytes the can be written to a mailslot.

Usage

[form.]Mailslot.MessageSize[ = setting ] Not available at run time.

Remarks

This property is used only when the mailslot is created.

Windows for Workgroups places a limit of 400 bytes on the MessageSize property.

Data Type

Integer  (1-400)


Message (Mailslot)

Applies To

Mailslot

Description

Contains the most recently read message after invoking the Read action. Message to send when invoking the Write action.

Usage

[form.]Mailslot.Message[ = setting ] Not available at design time.

Data Type

String


Priority (Mailslot)

Applies To

Mailslot

Description

Priority of the next message sent, or previous message read.

Usage

[form.]Mailslot.Priority[ = setting ] Not available at design time.

Remarks

Specifies the message priority (0 through 9). High-priority messages are generally placed ahead of previously stored messages that have lower priority.

Data Type

Integer (0-9)


Timeout (Mailslot)

Applies To

Mailslot

Description

Sets maximum amount of time to wait for message to be read.

Usage

[form.]Mailslot.Timeout[ = setting ]

Remarks

Specifies how many milliseconds to wait if a message is not available immediately (or how long to wait to Write to a mailslot if it is full).  If this value is zero, the Read (Write) action does not wait; if it is -1 the action waits indefinitely.

Data Type

Integer


MailslotSize (Mailslot)

Applies To

Mailslot

Description

Sets the maximum number of bytes available in the mailslot's buffer.

Usage

[form.]Mailslot.MailslotSize	Read only  at run time.

Remarks

Specifies the size, in bytes, of the mailslot. This parameter must be zero, or it must be equal to or exceed the size of the MessageSize property. If this value is zero, the Create action sets a value based on MessageSize.

Data Type

Integer


NextSize (Mailslot)

Applies To

Mailslot

Description

Gives the size of the next message, if any, in the mailslot.

Usage

[form.]Mailslot.NextSize 	Not avaliable at design time.

Remarks

Contains the size, in bytes, of the next message in the mailslot. If the mailslot does not contain another message, the NextSize property is set to zero.  This property is updated each time a Read or Peek action is invoked.

Data Type

Integer


NextPriority (Mailslot)

Applies To

Mailslot

Description

Gives the priortiy of the next message, if any, in the mailslot.

Usage

[form.]Mailslot.NextPriority 	Not avaliable at design time.

Remarks

Contains the priority (0 through 9) of the next message in the mailslot. This priority value is valid only if the NextSize parameter is not set to zero. This property is updated each time a Read or Peek action is invoked.

Data Type

Integer